<include file="Public:header" />
<div class="subnav">
  <div class="explain-col" >
    <form name="searchForm" id="searchForm" method="get" action="">
      <table class="add-table">
        <tr>
          <td width="240">
            学员姓名：<input type="text" name="keyword" id="keyword" size="20"  value="{$Think.get.keyword}" class="input-text" placeholder="请输入学员姓名" />
          </td>
          <td width="240">
            联系电话：<input type="text" name="keyword" id="keyword" size="20"  value="{$Think.get.keyword}" class="input-text" placeholder="请输入联系方式" />
          </td>
          <td width="240">
            &nbsp;QQ号码：<input type="text" name="keyword" id="keyword" size="20"  value="{$Think.get.keyword}" class="input-text" placeholder="请输入QQ号码" />
          </td>
          <td>
            课程项目：
            <select name="role_id" id="role_id">
              <option value="0">请选择所属分组</option>
              <volist name=":get_counselor_list()" id="vo">
                <option value="{$vo.id}"  >{$vo.name}</option>
              </volist>
            </select>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            课程详细：<input type="text" name="keyword" id="keyword" alue="{$Think.get.keyword}" class="input-text" placeholder="" style="width:300px;" />
          </td>
        </tr>
        <tr>
          <td>
            所属顾问：
            <select name="role_id" id="role_id">
              <option value="0">请选择所属分组</option>
              <volist name=":get_counselor_list()" id="vo">
                <option value="{$vo.id}"  >{$vo.name}</option>
              </volist>
            </select>
          </td>
          <td>
            意向级别：
            <select name="role_id" id="role_id">
              <option value="0">请选择级别</option>
              <volist name=":levelArr()" id="vo">
                <option value="{$key}"  >{$vo}</option>
              </volist>
            </select>
          </td>
          <td>
            详细级别：<input type="text" name="keyword" id="keyword" size="20"  value="{$Think.get.keyword}" class="input-text" />
          </td>
          <td></td>
        </tr>
        <tr>
          <td>
            咨询方式：
            <select name="role_id" id="role_id">
              <option value="0">请选择咨询方式</option>
              <volist name=":get_source_list()" id="vo">
                <option value="{$vo.id}"  >{$vo.name}</option>
              </volist>
            </select>
          </td>
          <td>
            &nbsp;&nbsp;&nbsp;合作方：
            <select name="role_id" id="role_id">
              <option value="0">请选择级别</option>
              <volist name=":levelArr()" id="vo">
                <option value="{$key}"  >{$vo}</option>
              </volist>
            </select>
          </td>
          <td>
            跟进时间：<input type="text" name="keyword" id="keyword" size="20" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"  value="{$Think.get.keyword}" class="input-text Wdate" />
          </td>
          <td></td>
        </tr>
        <tr>
          <td colspan="4"> <input type="submit" value=" 添加学员 " class="button"  style=" position: relative; top:50%; left:50%;" /></td>
        </tr>
      </table>
    </form>
  </div>
</div>
<!--subnav-->

<div class="pad-lr-10">
    <div class="table-list">
    <form name="listForm" id="listForm" action="__URL__/updateGroupSort" method="GET">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
            <th align="center" width="50">排序</th>
            <th align="center" width="20">ID</th>
            <th align="left" style="padding-left:50px;" width="120">分组名称</th>
            <th align="left">备注信息</th>
            <th align="center" width="50">状态</th>
            <th align="center" width="120">创建人</th>
            <th align="center" width="120">创建时间</th>
            <th align="center" width="120">管理操作</th>
          </tr>
        </thead>
        <tbody id="list">
          <volist name="list" id="vo">
            <tr id="list_{$vo.id}">
              <td align="center"><input name='sortArr[]' type='text' size="4" value='{$vo.sort}' class='input-text-c'><input name='idArr[]' type="hidden" value='{$vo.id}'></td>
              <td align="center" >{$vo.id}</td>
              <td align="left" style="padding-left:50px;">{$vo.name}</td>
              <td align="left">{$vo.remark}</td>
              <td align="center"><a href="javascript:changeStatus({$vo.id});" id="status-{$vo.id}" name="{$vo.status}" title="" class="status" >{$vo.statusName}</a></td>
              <td align="center" width="120">{$vo.creater}</td>
              <td align="center">{$vo.create_time|date='Y-m-d H:i:s',###}</td>
              <td align="center"><a href="javascript:openWinBox('__URL__/addGroup/id/{$vo.id}','编辑分组信息');" >编辑</a></td>
            </tr>
          </volist>
          <empty name="list">
            <tr>
              <td colspan="5" align="center">请添加电话分组</td>
            </tr>
          </empty>
        </tbody>
      </table>
      <div class="btn">
        <div id="pages">{$page}</div>
        <input name="submit" type="submit" class="button" value="更新排序" >
      </div>
      </form>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
	$(".status").each(function(i, val) {
        var status = $(this).attr('name');
		if(status==1){
			$(this).addClass('blue');
		}else{
			$(this).addClass('red');
		}
    });


	$('#listForm').submit(function(){
       // 加入需要的操作代码
       $('#listForm').ajaxSubmit({
           beforeSubmit:  checkForm,
           success:       complete
       });
       return false;
	});

	function checkForm(){
		return true;
	}

	var origin = $.artDialog.open.origin;
    function complete(data){
		if(data.status==1){
			art.dialog({id:'TNCICC',content: data.info,time: 2,icon:'succeed'});
		}else{
			art.dialog({id:'TNCICC',content: data.info,time: 2,icon:'warning'});
		}
		setTimeout(function(){origin.location.reload();},1000);
    }
})

function checkall(){
	$("input[name=idArr[]]").each(function(){
		if(this.checked == false)
			this.checked = true;
		else
			this.checked = false;
	});
}

//异步修改状态
function changeStatus(id){
	var statusId = $("#status-"+id).attr('name');
	$.get("__URL__/changeGroupStatus/id/"+id+"/statusId/"+statusId, function(data) {
	if(statusId==1){
			$("#status-"+id).text('已禁用');
			$("#status-"+id).attr('name',0);
			$("#status-"+id).attr('class','red');
		}else{
			$("#status-"+id).text('已启用');
			$("#status-"+id).attr('name',1);
			$("#status-"+id).attr('class','blue');
		}
	});
}
</script>